home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-16 | 2.7 KB | 107 lines | [TEXT/CWIE] |
- // Release Version: $ ODF 1 $
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
-
- //========================================================================================
- #include "Data.hpp"
-
- #ifndef CONTENT_H
- #include "Content.h"
- #endif
-
- #ifndef PART_H
- #include "Part.h"
- #endif
-
- #ifndef FWUTIL_H
- #include "FWUtil.h"
- #endif
-
- #ifndef PIZZA_H
- #include "Pizza.h" // CPizza
- #endif
-
- //========================================================================================
- #ifdef FW_BUILD_MAC
- #pragma segment Data
- #endif
-
- //========================================================================================
- FW_DEFINE_AUTO(CPizzaCollection)
- FW_DEFINE_AUTO(CPizzaCollectionIterator)
- FW_DEFINE_AUTO(CDataContent)
-
- //----------------------------------------------------------------------------------------
- CDataContent::CDataContent(Environment* ev, CDataPart* part)
- : FW_CContent(ev, part),
- fStringPtr(NULL),
- fBufferPtr(NULL),
- fBufferBytes(0),
- fPart(part),
- fNumPizzas(0),
- fPizzaList(NULL)
- {
- fEmbeddedString.ReplaceAll("Embedded string");
- fStringPtr = FW_NEW(FW_CString32, ("String Pointer") );
-
- // init buffer
- fBufferBytes = 1000;
- fBufferPtr = FW_CMemoryManager::AllocateBlock(fBufferBytes);
-
- fPizzaList = FW_NEW(CPizzaCollection, ());
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- CDataContent::~CDataContent()
- {
- FW_START_DESTRUCTOR
- delete fStringPtr;
- FW_CMemoryManager::FreeBlock(fBufferPtr);
- CPizza* pizza = NULL;
- while ((pizza = (CPizza*)fPizzaList->First()) != NULL) {
- fPizzaList->Remove(pizza);
- delete pizza;
- }
- delete fPizzaList;
- }
-
- //----------------------------------------------------------------------------------------
- CPizzaCollection*
- CDataContent::MyGetPizzaList()
- {
- return fPizzaList;
- }
-
- //----------------------------------------------------------------------------------------
- void
- CDataContent::MyIncrement(Environment* ev, FW_CPoint& position)
- {
- fNumPizzas++;
-
- FW_CPoint halfSize( FW_IntToFixed(15), FW_IntToFixed(15) );
- FW_CRect bounds(position - halfSize, position + halfSize);
-
- CPizza* pizza = new CPizza(bounds);
- fPizzaList->AddLast(pizza);
- fPart->MyInvalidatePresentation(ev, bounds);
- }
-
- //----------------------------------------------------------------------------------------
- void
- CDataContent::Externalize(Environment* ev,
- ODStorageUnit* storageUnit,
- FW_EStorageKinds storageKind,
- FW_CCloneInfo* cloneInfo)
- {
- }
-
- //----------------------------------------------------------------------------------------
- FW_Boolean
- CDataContent::Internalize(Environment* ev,
- ODStorageUnit* storageUnit,
- FW_EStorageKinds storageKind,
- FW_CCloneInfo* cloneInfo)
- {
- return FALSE;
- }
-